Input Devices

Texto Justificado

Group assignment:

  • Probe an input device(s)'s analog levels and digital signals.
  • Document your work on the group work page and reflect on your individual page what you learned.

Individual assignments

  • Measure something: add a sensor to a microcontroller board that you have designed and read it.

Group assignment

  • Here is the link where you can see the development of the week's group assignment.Group Assignment

This week, we carried out group work in which each team member used their own sensors, maintaining an online connection throughout the process. We used the Zoom platform to meet, which allowed us to discuss and carry out tests with different sensors. In my case, I focused on the turbidity sensor and we were able to work collaboratively to obtain effective results.

Imagen

To analyze this data, we performed the test using the Arduino IDE development environment and the following code, as part of our first job.


Code

These are the results we obtained after uploading them to the XIAO, which allowed us to perform a more detailed analysis of the collected data.

Imagen


Imagen pic207

Photoresistor

An exciter or photoresistor is an electronic component whose resistance changes (normally decreases) with increasing intensity of incident light.1 It can also be called a photoconductor, photoelectric cell or light-dependent resistor, whose acronym, LDR, originates from from its English name light-dependent resistor. Its body is made up of a photoreceptor cell and two pins. The following image shows its electrical symbol.

Imagen

Its operation is based on the photoelectric effect. A photoresistor is made of a high-resistance semiconductor such as cadmium sulfide, CdS. If the light incident on the device is of high frequency, the photons are absorbed by the elasticities of the semiconductor giving the electrons sufficient energy to skip the driving band. The resulting free electron and its associated hole conduct electricity, thereby decreasing resistance. Typical values ​​range from 1 MΩ or more in the dark to 100 Ω in bright light.

Component Inventory

  • Motherboard for the Xiao
  • Xiao RP2040
  • Photoresistor Sensor

The next step involves uploading the code that interprets the sensor values, allowing us to obtain accurate readings and better understand the data collected.

Code



Imagen

Case 1

We continue reading the sensor values. As a first measure, we cover the sensor with our hand and then observe the results on the serial port.

Imagen
Imagen


Imagen pic207

Case 2

On this occasion, I provided direct illumination to the LDR sensor, which will allow you to clearly see the marked difference in the data collected.

Imagen
Imagen


Imagen pic207

The following image shows a sequence of chart data collected by the Serial Plotter.


Imagen

"Fue una semana tremendamente productiva, ya que como equipo de Fablab Perú, mis colegas Grace, Wilber, Renso y yo mismo tuvimos la oportunidad de experimentar con una variedad de sensores. Cada uno de nosotros compartió nuestras experiencias individuales, enriqueciendo así nuestro conocimiento colectivo".

Individual assignment

  • To perform this individual task, I used an analog sensor to perform the relevant tests and measurements. In my case I used the water turbidity sensor.Sensor de turbidez.

Specification turbidity sensor

  • Operating Voltage: DC 5V
  • Operating Current: about 11mA
  • Detection Range: 0%--3.5%(0-4550NTU)
  • Operating Temperature: -30℃~80℃
  • Storage Temperature:-10℃~80℃
  • Error Range: ±0.5%F*S
  • Weight: 18g
Imagen

Pin configuration

Item Value
5V: 5V DC XIAO / +V Sensor
GND: GND XIAO/ G Sensor
Analogical: A0 XIAO/ A-OUT Sensor

Serial Communication

Tests to be carried out with XIAO RP2040

The connection circuit between the XIAO RP2024 and the water turbidity sensor is as follows:

Imagen

Having already installed the XIAO RP2040 board, go to Tools -> Board, search for "Seeed Studio XIAO RP2040" and select it. With this, we will have completed the configuration of the Seeed Studio XIAO RP2040 for the Arduino IDE. Then we select the serial position.

Imagen


Imagen pic207

Connect the water turbidity sensor to Pin A0 as an analog input signal. Next, load the following code to be able to view the values ​​in real time.

Turbidity sensor code with Xiao RP2040



Case 1: Clean Water

Imagen pic193

Reading data in serial communication

According to the data obtained, clean water shows 5V and values ​​of 1023, which is equivalent to 10 bits.

Imagen pic193


Imagen pic207


Case 2: Yellow earth dissolved in water

Imagen pic193

Now for the next case of yellow soil dissolved in water. As shown below, the voltage values ​​have changed, being approximately 3V in this case. Additionally, you can observe the drop in the graph on the plotter serial communicator

Imagen pic193

Imagen pic193


Case 3: Strong coffee dissolved in water

Imagen pic193

In this third case, it is observed that the turbidity of the water has increased considerably, since the voltage has decreased to approximately 1V. Likewise, it is observed in the plotter serial communication that it drops significantly.

Imagen pic193


Imagen pic207

What are the units of turbidity?

The turbidity unit was defined “as the optical obstruction of light, caused by one million silica in distilled water.” There are different units to express turbidity: NTU, FNU, FAU and JTU.

  • Nephelometric Turbidity Unit (NTU): Only used when results are determined using the 90° dispersion method and EPA specifies the use of this unit for method 180.1. It is the most common unit in use and is generally applied to all instruments such as turbidimeters.
  • Formazin Turbidity Unit (FTU): This is the second most common unit in use and again defines a nephelometric dispersion from the EPA or ISO method.
  • Formazin Nephelometric Unit (FNU): Technically defines measurement with the 90° detector and is most correctly applied to instruments using the ISO 7027 method.

Wifi Communication

Tests to be carried out with XIAO ESP32-C3

To carry out this example, I chose to use the XIAO ESP32-C3 due to the need for a Wi-Fi connection to be able to view real-time data on the state of water turbidity. This data is hosted on a free web server at ThingSpeak. This example is complementary to my final project and contributes significantly to its functionality.

Imagen

Pinout for example

Item Value
5V: 5V DC XIAO / +V Sensor
GND: GND XIAO/ G Sensor
Analogical: A0 XIAO/ A-OUT Sensor


Log in with your Gmail account

The steps are simple; You only need an email, in my case, my personal email, to be able to use ThingSpeak.

The next step is to log in and create an account, as shown in the image.

Imagen pic193


Imagen pic207

After creating your account, the next step is to configure it and take note of the API Key.

Imagen pic193


Imagen pic207

To illustrate reading over Wi-Fi, I relied on the XIAO ESP32-C3 along with a turbidity sensor, as well as the board I presented in previous weeks. We start by selecting the board and the COM port that we will use.

Imagen pic193


Imagen pic207

Turbidity sensor code with XIAO ESP32-C3

Case 1: Clean water

For this practical exercise, I selected two containers: one containing clear water and one containing cloudy water, in order to illustrate the differences in the reading process.

Imagen

With this experiment, we can observe the data that is generated in the cloud and view it in the control panel

Imagen pic193


Imagen pic207

Case 2 cloudy water

In the next step, we can show the values ​​generated with turbid water, all done for academic purposes.

Imagen pic193


Imagen pic207

Now that we have established data collection in the cloud on a regular basis, we have the advantage of being able to access it at any time. This functionality gives us the ability to export the data according to our needs, allowing us to perform deeper analyzes or share the information conveniently when necessary.



In summary

This week was a lot of learning as it allowed me to explore the turbidity sensor. Interpreting the voltage data was critical to understanding water quality: higher values ​​indicate greater clarity. Real-time visualization using the Arduino IDE allowed turbidity changes to be monitored instantly. Experimenting with different elements added to water provided a deeper understanding of how they affect turbidity levels

Links to all working files used this week

1. Turbidity NTU.ino
2. Turbidity.ino